/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     Sent_PBCfg.c                                                                              *
 *  \brief    This file contains interface header for SENT MCAL config                                  *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date                    <th>Version                                                          *
 * <tr><td>2025-03-25 19:03:22     <td>1.0.0 R                                                          *
 * </table>                                                                                             *
 *******************************************************************************************************/
/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Sent_Cfg.h"
#include "__regs_base.h"
#include "Part.h"
#include "Compiler.h"

extern void sent_channel0_callback(Sent_Ip_ChannelStaType chnSta);

#define SENT_START_SEC_CONST_UNSPECIFIED
#include "Sent_MemMap.h"

/** \brief  SENT time stamp config generate */
const Sent_TimeStampCfgType Sent_TimeStampCfg[SENT_TIME_STAMP_NUM] =
{
    /** SentConfigSet_0 */
    {
        .base = APB_SENT_BASE,
        .div = 100UL,
        .coreId = CPU_INDEX_0,
    },
};

/** \brief  SENT CRC4 config generate */
static const Sent_Ip_Crc4CtrlType Sent_Crc4Cfg[SENT_CHANNEL_NUM] =
{
    /** SentChannelConfigSet_0 */
    {
        .chanCrcMode = SENT_STANDARD,
        .statusNibCrc = FALSE,
        .serDataCrc4 = SENT_SAE_J2716_2008,
        .nibbleDataCrc4 = SENT_SAE_J2716_2008,
    },
    /** SentChannelConfigSet_1 */
    {
        .chanCrcMode = SENT_STANDARD,
        .statusNibCrc = FALSE,
        .serDataCrc4 = SENT_SAE_J2716_2008,
        .nibbleDataCrc4 = SENT_SAE_J2716_2008,
    },
};

/** \brief  SENT config generate */
const Sent_ChannelCfgType Sent_ChannelCfg[SENT_CHANNEL_NUM] =
{
    /** SentChannelConfigSet_0 */
    {
        .channelCfg =
        {
            .base = APB_SENT_BASE,
            .channelId = SENT_CHANNEL0,
            .chnCfg =
            {
                .div = 20UL,
                .tickCoun = 100UL,
                .wdtLen = 1024UL,
                .ignoreFirSer = FALSE,
                .frameCrcDisable = FALSE,
                .serialCrcDisable = FALSE,
                .crc4Cfg = &(Sent_Crc4Cfg[0]),
                .calibPulse = SENT_CAL_PULSE_25,
                .calibSel = SENT_SYNC_PULSE_OPTION1,
                .FirstCalPulseChk = FALSE,
                .enhancedDataEn = FALSE,
                .frameLenChkEn = FALSE,
                .pausePulseEn = FALSE,
                .nibbleNum = 6UL,
                .dataView = 0x76543210UL,
                .chnGlitchFall = 24UL,
                .chnGlitchRis = 24UL,
                .chnFirstGlitchIgnore = FALSE,
                .invertInputSigEn = FALSE,
                .dmaSerEn = FALSE,
                .dmaNibEn = FALSE,
            },
        },
        .coreId = CPU_INDEX_0,
        .notification = &sent_channel0_callback,
        .serUnderRunInt = FALSE,
        .nibUnderRunInt = FALSE,
        .serReadyInt = TRUE,
        .nibReadyInt = TRUE,
        .DmaNibbleBuff = NULL_PTR,
        .DmaNibbleBuffLen = 0UL,
        .DmaSerBuff = NULL_PTR,
        .DmaSerBuffLen = 0UL,
    },
    /** SentChannelConfigSet_1 */
    {
        .channelCfg =
        {
            .base = APB_SENT_BASE,
            .channelId = SENT_CHANNEL1,
            .chnCfg =
            {
                .div = 1UL,
                .tickCoun = 1UL,
                .wdtLen = 1024UL,
                .ignoreFirSer = FALSE,
                .frameCrcDisable = FALSE,
                .serialCrcDisable = FALSE,
                .crc4Cfg = &(Sent_Crc4Cfg[1]),
                .calibPulse = SENT_CAL_PULSE_25,
                .calibSel = SENT_SYNC_PULSE_OPTION1,
                .FirstCalPulseChk = FALSE,
                .enhancedDataEn = FALSE,
                .frameLenChkEn = FALSE,
                .pausePulseEn = FALSE,
                .nibbleNum = 6UL,
                .dataView = 0x76543210UL,
                .chnGlitchFall = 0UL,
                .chnGlitchRis = 0UL,
                .chnFirstGlitchIgnore = TRUE,
                .invertInputSigEn = FALSE,
                .dmaSerEn = FALSE,
                .dmaNibEn = FALSE,
            },
        },
        .coreId = CPU_INDEX_0,
        .notification = NULL_PTR,
        .serUnderRunInt = FALSE,
        .nibUnderRunInt = FALSE,
        .serReadyInt = FALSE,
        .nibReadyInt = FALSE,
        .DmaNibbleBuff = NULL_PTR,
        .DmaNibbleBuffLen = 0UL,
        .DmaSerBuff = NULL_PTR,
        .DmaSerBuffLen = 0UL,
    },
};

#define SENT_STOP_SEC_CONST_UNSPECIFIED
#include "Sent_MemMap.h"
/* End of file */
